package bigraph.commands;

import org.eclipse.draw2d.geometry.Rectangle;

import bigraph.model.Root;

public class RootChangeLayoutCommand extends AbstractLayoutCommand {
	
	private Root model;
	private Rectangle layout;
	private Rectangle oldLayout;
	
	public void execute() {
	     model.setLayout(layout);
	}

	@Override
	public void setConstraint(Rectangle rect) {
		this.layout = rect;

	}

	@Override
	public void setModel(Object model) {
		this.model = (Root)model;
		this.oldLayout = ((Root)model).getLayout();

	}
	
	public void undo() {
	     this.model.setLayout(this.oldLayout);
	}

}
